------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  E:\REStat_MS14767_Vol96(2)\Data preparation Compustat segment\5_RJV_panel.log
  log type:  text
 opened on:  18 Dec 2014, 18:06:08

. *-----------------------------------------------------------------
. 
. set mem 1000m

. set mat 2000

. 
. **********************************************************************
. *** This file generates a basic dataset combining information from ***
. *** compustat and rjv data. All compustat firms remain in the      ***
. *** dataset whereas rjvs without ticker drop out.                          ***
. **********************************************************************
. 
. use "raw data\JV180506_corrected_ticker.dta", clear

. drop multiple sic2 count

. 
. sort entityname

. merge m:m entityname  using "raw data\JV180506_corrected_ticker_nonprofit.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                            14,016  (_merge==3)
    -----------------------------------------

. drop _merge inset2 

. 
. *************
. * correct ticker for some companies
. * the ticker variable of this dataset has been compared to the one
. * in the compustat data. Here tickers are changed in order to
. * make connections obvious.
. *************
. 
. replace ticker="ADEP" if ticker=="3ADEO"   /*Adept Technology, Inc.             */
(2 real changes made)

. replace ticker="AMPX" if ticker=="3AEXCA" /*Ampex Corp.                     */
(4 real changes made)

. replace ticker="CMDZQ" if ticker=="3CMDZE" /*Comdial Corporation            */
(1 real change made)

. replace ticker="DVW" if ticker=="3COVD"  /*Covad Communications Group, Inc. */
(1 real change made)

. replace ticker="PRAC" if ticker=="3PRAC"  /*Productivity Technologies Corp. */
(3 real changes made)

. replace ticker="TGIS" if ticker=="3TGIS"  /*Thomas Group, Inc.                  */
(1 real change made)

. replace ticker="3DVNTF" if ticker=="9142B" /* Diversinet Corp.                  */
(1 real change made)

. replace ticker="ADCT" if ticker=="ADCTD"  /*ADC Telecommunications, Inc.    */
(12 real changes made)

. replace ticker="AEIS" if ticker=="AEISE"  /*Advanced Energy Industries, Inc.*/
(1 real change made)

. replace ticker="AOLAQ" if ticker=="AOLA" /* America Online, Inc.                        */
(4 real changes made)

. replace ticker="BCE1" if ticker=="BCE1."  /*Bell Canada                     */
(5 real changes made)

. replace ticker="CDNS" if ticker=="CDN"    /*Cadence Design Systems, Inc.    */
(19 real changes made)

. replace ticker="CIC." if ticker=="CERTF" /* Certicom Corp.                              */
(2 real changes made)

. replace ticker="3CRMT" if ticker=="CK"    /*Crompton Corp.                  */
(2 real changes made)

. replace ticker="CRWN" if ticker=="CRWNE"  /*Crown Media Holdings, Inc.      */
(2 real changes made)

. replace ticker="CSPIE" if ticker=="CSPI"   /*CSP, Inc.                      */
(1 real change made)

. replace ticker="DMRC" if ticker=="DMRCE"  /*Digimarc Corp.                  */
(2 real changes made)

. replace ticker="3EXBY" if ticker=="3EXBT"       /* Exabyte Corp.                                */
(1 real change made)

. replace ticker="3PCOM." if ticker=="3PCMC" /* P-Com, Inc.                               */
(1 real change made)

. replace ticker="GSIG" if ticker=="GSLI" /* GSI Group Inc.                               */
(2 real changes made)

. replace ticker="FON.R" if ticker=="FON"    /*Sprint Corp.                       */
(18 real changes made)

. replace ticker="0780B" if ticker=="HTN."   /*Houghton Mifflin Co.             */
(1 real change made)

. replace ticker="3IMCI" if ticker=="IMCI"   /*Infinite Group, Inc.             */
(2 real changes made)

. replace ticker="KAMN" if ticker=="KAMNA"  /*Kaman Corp.                       */
(3 real changes made)

. replace ticker="NHYB" if ticker=="KSRC"   /*Kendall Square Research Corp.     */
(2 real changes made)

. replace ticker="LORL" if ticker=="LRLSQ"  /*Loral Space & Communications Corp.*/
(13 real changes made)

. replace ticker="NER.3" if ticker=="NER"         /* Newcor, Inc.                         */
(1 real change made)

. replace ticker="NGH." if ticker=="NGH"  /* Nabisco Group Holding                */
(2 real changes made)

. replace ticker="NIF.U" if ticker=="NRD" /* Noranda, Inc.                                */
(1 real change made)

. replace ticker="0782B" if ticker=="NTK"    /*Nortek, Inc.                     */
(6 real changes made)

. replace ticker="3NTPA" if ticker=="NTPA"   /*Netopia Inc.                     */
(1 real change made)

. replace ticker="PCZ" if ticker=="PCA."  /* Petro-Canada Inc.                    */
(7 real changes made)

. replace ticker="SPM.3" if ticker=="SPM."        /*Saga Petroleum Asa                    */
(3 real changes made)

. replace ticker="SJR.NV.B" if ticker=="SJR" /* Shaw Communications Inc.          */
(1 real change made)

. replace ticker="3SGID" if ticker=="SGI"    /*Silicon Graphics, Inc.           */
(17 real changes made)

. replace ticker="SMU.1" if ticker=="SMU"    /*Simula, Inc.                     */
(1 real change made)

. replace ticker="SYN.1" if ticker=="SYN"    /*Syntex Corp.                     */
(4 real changes made)

. replace ticker="TFSI" if ticker=="TFS"    /*Three-Five Systems, Inc.          */
(2 real changes made)

. replace ticker="WXCP" if ticker=="WHXCQ"  /*WHX Corp.                         */
(1 real change made)

. replace ticker="LSMJ" if ticker=="XSYS"   /*XXsys Technologies, Inc.          */
(1 real change made)

. 
. *************
. * for the following companies, observations will be dropped after
. * merging the datasets, because no counterpart could be traced in
. * the compustat data. Sometimes there are companies with similar
. * names in the compustat data, but whether they actually are the
. * same remains unclear. In particular, AOL is foud in the compustat
. * data as "AMERICA ONLNE LTN AMR  -CL A" and ticker "AOLAQ" Here, the ticker numer and
. * the name as given in "entityname" are listed;
. *4135B   ABKCO Music & Records
. *HI  Household International, Inc.
. *LCO.    Louisville Cement Co.
. *LYON.   Lyon Metal Products, Inc.
. *PCSI.   Paragon Communications Systems
. *SBC SBC Communications, Inc.
. *SNGR    Singer Co. N.V.
. *SNTEQ   Santec Corp.
. *WEPC    West Chemical Products, Inc.
. *************
. 
. egen rjvnum=group(rjvname)

. egen comnum=group(entityname)
(1 missing value generated)

. 
. so rjvnum

. save "RJV files\insiders_observed.dta", replace
file RJV files\insiders_observed.dta saved

. 
. 
. *************
. * here we generate a panel at the RJV level, which still contains all firms information
. * we do this in order to build variables related to the size of RJV per year (nfirmP)
. * the number of compustat firms in a RJV per year (nfirmCOMP)
. * as well as the number of firms in the same SIC4 industry per year (nfirmPsame)
. *************
. 
. use "RJV files\insiders_observed.dta", clear

. 
. *************
. * blow it up to a panel for 1985 - 1999
. *************
. 
. gen year=1985

. save "RJV files\rjv1985.dta", replace
file RJV files\rjv1985.dta saved

. local i=85

. forvalues i=86/99 {
  2. replace year=19`i'
  3. save "RJV files\rjv19`i'.dta", replace
  4. }
(14016 real changes made)
file RJV files\rjv1986.dta saved
(14016 real changes made)
file RJV files\rjv1987.dta saved
(14016 real changes made)
file RJV files\rjv1988.dta saved
(14016 real changes made)
file RJV files\rjv1989.dta saved
(14016 real changes made)
file RJV files\rjv1990.dta saved
(14016 real changes made)
file RJV files\rjv1991.dta saved
(14016 real changes made)
file RJV files\rjv1992.dta saved
(14016 real changes made)
file RJV files\rjv1993.dta saved
(14016 real changes made)
file RJV files\rjv1994.dta saved
(14016 real changes made)
file RJV files\rjv1995.dta saved
(14016 real changes made)
file RJV files\rjv1996.dta saved
(14016 real changes made)
file RJV files\rjv1997.dta saved
(14016 real changes made)
file RJV files\rjv1998.dta saved
(14016 real changes made)
file RJV files\rjv1999.dta saved

. use "RJV files\rjv1985.dta", clear

. 
. append using "RJV files\rjv1986.dta"

. append using "RJV files\rjv1987.dta"

. append using "RJV files\rjv1988.dta"

. append using "RJV files\rjv1989.dta"

. append using "RJV files\rjv1990.dta"

. append using "RJV files\rjv1991.dta"

. append using "RJV files\rjv1992.dta"

. append using "RJV files\rjv1993.dta"

. append using "RJV files\rjv1994.dta"

. append using "RJV files\rjv1995.dta"

. append using "RJV files\rjv1996.dta"

. append using "RJV files\rjv1997.dta"

. append using "RJV files\rjv1998.dta"

. append using "RJV files\rjv1999.dta"

. sort rjvnum year comnum

. 
. desc

Contains data from RJV files\rjv1985.dta
  obs:       210,240                          
 vars:            14                          18 Dec 2014 18:06
 size:    78,840,000                          
------------------------------------------------------------------------------------------------------------------------------------------
              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------------------------------------------------------------------
rjvname         str161  %161s                 RJVNAME
entryname       str100  %100s                 ENTRYNAME
entityname      str76   %76s                  ENTITYNAME
ticker          str8    %9s                   TICKER
jv_year         int     %8.0g                 JV_YEAR
eyear           int     %8.0g                 EYEAR
xyear           int     %8.0g                 XYEAR
sic4            int     %8.0g                 SIC4
nonprofit       byte    %8.0g                 NONPROFIT
foreign1        str5    %9s                   FOREIGN1
foreign         float   %9.0g                 
rjvnum          float   %9.0g                 group(rjvname)
comnum          float   %9.0g                 group(entityname)
year            float   %9.0g                 
------------------------------------------------------------------------------------------------------------------------------------------
Sorted by:  rjvnum  year  comnum
     Note:  dataset has changed since last saved

. 
. save "raw_rjv_panel.dta", replace
file raw_rjv_panel.dta saved

. log close
      name:  <unnamed>
       log:  E:\REStat_MS14767_Vol96(2)\Data preparation Compustat segment\5_RJV_panel.log
  log type:  text
 closed on:  18 Dec 2014, 18:06:19
------------------------------------------------------------------------------------------------------------------------------------------
